import Vue from "vue"
import VueRouter from "vue-router"

Vue.use(VueRouter)
import Latout from "@/layout/layout.vue"
import Login from "@/view/login"
const routes = [

    {
        path: '/login',
        component: Login
    },
    // 一级路由
    {
        path: '/',
        redirect: '/login'
    },
    {
        path: '/detail',
        name: 'detail',
        component: () => import('@/view/detail')
    },
    {
        path: '/home',
        component: Latout,
        redirect: '/home/goods',
        // 二级路由
        children: [
            {
                path: '/home/goods',
                component: () => import('@/view/goods')
            },
            {
                path: '/home/shop',
                component: () => import('@/view/shop')
            },
            {
                path: '/home/comment',
                component: () => import('@/view/comment')
            },
        ]
    },


]

const router = new VueRouter({
    routes,
})

export default router